using System;
using System.Collections.Generic;
using System.Text;
using Marlimer.Common;
using System.Data.SqlClient;
using System.Data;


namespace Marlimer.Data.Universal
{
    public class uni_TipoMoneda
    {
        public DataTable getDTTipoMoneda()
        {
            SqlCommand sqlcmd = new SqlCommand();
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();

            sqlcmd.CommandText = "spsdtTipoMoneda";
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Connection = Session.getConexion();

            da.SelectCommand = sqlcmd;
            da.Fill(ds);
            return ds.Tables[0]; 
        }

        public double getValMoneda(int ccod_mone)
        {
            SqlCommand sqlcmd = new SqlCommand();
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();
            int resul = 1;

            sqlcmd.CommandText = "spsTipoMonedaByCod";
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Connection = Session.getConexion();
            sqlcmd.Parameters.Add("@ccod_mone", SqlDbType.Int);
            sqlcmd.Parameters["@ccod_mone"].Value = ccod_mone;

            da.SelectCommand = sqlcmd;
            da.Fill(ds);

            if (ds.Tables[0].Rows.Count > 0)
            {
                resul = Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray.GetValue(2));
            }
            return resul; 
        }
    }
}
